public class GoodsTest {
    public static void main(String[] args) {
        Goods[] arr = new Goods[3];

        Goods g1 = new Goods("001", "苹果",5.5,100);
        Goods g2 = new Goods("002", "菠萝",15.5,200);
        Goods g3 = new Goods("003", "草莓",25.5,180);

        arr[0] = g1;
        arr[1] = g2;
        arr[2] = g3;

        for (int i = 0; i < arr.length; i++) {
            System.out.println("商品的id：" + arr[i].getId() + "商品的名字：" +
                    arr[i].getName() + "商品的价格:" + arr[i].getPrice() + "商品的数量:" + arr[i].getCount());
        }
    }
}
